
<link href="style.css" rel="stylesheet" type="text/css" media="screen" />
<table border="0" align="center" width="500px" id="result">
    <thead>
        <tr>
            <th>PSB Id</th>
            <th>Keterangan</th>
        </tr>
    </thead>
    <tbody>


        <?php
        $find = false;
		// mengambil data dari yg dimasukkan ke dalam 'txtfield'
        if (isset($_POST['id'])) {
            if (!trim($_POST['id']) == "") {

                $file = fopen("psbFile/data.txt", "r");
                $data = fread($file, filesize("psbFile/data.txt"));
                $data = explode("\n", $data);
                for ($i = 0; $i < count($data); $i++) {
                    $datas = explode(";", $data[$i]);
                    if ($datas[0] == $_POST['id']) {
                        echo " <tr>
            <td>" . $datas[0] . "</td>
            <td>" . $datas[1] . "</td>
        </tr>";
                        $find = true;
                    }
                }
                if ($find == false) {
                    echo " <tr>
            <td colspan='2'>Data tidak ditemukan</td>
          
        </tr>";
                }
            } else {
                echo "<script>alert('Masukan ID PSB');window.history.back();</script>";
            }
        } else {
            echo "<script>alert('Masukan ID PSB');window.history.back();</script>";
        }
        ?>    </tbody>
</table>

<a href="psbView.php" style="text-align: center;font-size: 15px;font-weight: bold;">< < Kembali</a>